document.addEventListener('plusready',function(){
	var ws = plus.webview.currentWebview();
	var user = ws.user; 
	var name = ws.name; 
	console.log(user+'-'+name);
	//   注册验证
	$('.res_pasw').on('click',function(){
		var pass = $('.pass').val();
		var pass1 = $('.pass1').val();
		var pass_pay = $('.pass_pay').val();
		if(!pass || !pass1){
			toast('密码不能为空');
			return;
		} 
		if(pass != pass1){
			toast('密码错误，请确定两次密码一致');return;
		}
		if(pass.length < 6 || pass1.length < 6){
			toast('密码长度不能小于6！'); 
			return;
		}
		if(pass_pay.length != 6){
			toast('密码长度必须为6！'); 
			return;
		}
//		console.log(dt['tel']+'--'+dt['id']);
//		console.log(apiRoot + "?m=Home&c=Member&a=register1"+'&user='+dt['tel']+'&pass='+pass1+"&id="+dt['id']);
		$.ajax({  
			type:"post",   
			url: apiRoot + "?act=login&op=register",
			data:{pass:pass,pass_pay:pass_pay,user:user,name:name,client:'app'},
			dataType: 'json', 
			success:function(data){
				console.log(JSON.stringify(data));  
				if(data.msg == "注册成功！"){
					toast(data.msg);
					var nwaiting = plus.nativeUI.showWaiting();//显示原生等待框
					var webviewContent= plus.webview.create('./login.html','login.html');//后台创建webview并打开show.html
					webviewContent.addEventListener("loaded", function() { //注册新webview的载入完成事件
					        nwaiting.close(); //新webview的载入完毕后关闭等待框
					        ws.close();
					        webviewContent.show("slide-in-right",300); //把新webview窗体显示出来，显示动画效果为速度200毫秒的右侧移入动画
			        }, false);
//					plus.webview.create('./person2.html','person2.html').show('slide-in-right');
				}else{
					toast(data.msg);
				}
			},
			error:function(e){
			 	console.log(JSON.stringify(e));
			 	plus.nativeUI.toast('失去连接');
			 }
		});
	})
},false);